package planesimulator.plane.wing.coefficients;

/**
 * Lift coefficient for wings on tail of the plane.
 * @author Jakub Klimek
 */
public class TailLiftCoefficient implements LiftCoefficient {

  float keys[] = {
    0.000000f,
    2.000000f,
    4.000000f,
    6.000000f,
    8.000000f,
    10.000000f,
    12.000000f,
    14.000000f,
    16.000000f,
    18.000000f,
    20.000000f,
    22.000000f,
    24.000000f,
    26.000000f,
    28.000000f,
    30.000000f,
    32.000000f,
    40.000000f,
    90.000000f
  };
  float values2[] = {
    0.000000f,
    0.080649f,
    0.171679f,
    0.272702f,
    0.383261f,
    0.505427f,
    0.618501f,
    0.722779f,
    0.828237f,
    0.934990f,
    1.033748f,
    1.136124f,
    1.233577f,
    1.306947f,
    1.375418f,
    1.424852f,
    1.494603f,
    0.415162f,
    -0.000000f
  };
  ValueTable vt;

  public TailLiftCoefficient() {
    vt = new ValueTable(4, keys, values2);
  }

  public float lift(float deg) {
    if (deg < 0) {
      return -vt.interpolate(-deg);
    } else {
      return vt.interpolate(deg);
    }
  }
}

